package http

import (
	"gitee.com/liukexing/mqbroker/core/driver/component"
	"gitee.com/liukexing/mqbroker/core/server/pubsub"
	"gitee.com/liukexing/mqbroker/core/typedef"
	"time"
)

func NewCommandHandle() *pubsub.CommandServerHandle {
	return &pubsub.CommandServerHandle{
		Command: map[string]typedef.CommonMsgConfig{
			"Health": typedef.CommonMsgConfig{
				Handle: HealthCmd,
				Sub:    typedef.CommonMsgCheck{Receiver: Config.Info.ID},
			},
		},
	}
}

func EmptyCmd(Args map[string]interface{}) (map[string]interface{}, error) {
	return  nil,nil
}

//健康检查
func HealthCmd(Args map[string]interface{}) (map[string]interface{}, error) {
	LastTick = time.Now()
	return component.HealthCmd(Config.Info)
}
